<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>地图</title>
    <script src="https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=Nj2UrnWPzNF4a3ZGIXhlWRz2AcGrDWE8"></script>
</head>
<body>  
        <input  id="inp"/>
        <div id="app" style="width:1200px;height:800px">
        </div>
        <script>
            // 初始化地图
            var map = new BMapGL.Map("app");
            // 创建一个点
            var point = new BMapGL.Point(116.404, 39.915);
            // 设置地图的中心点与缩放级别
            map.centerAndZoom(point, 15); 
            // 鼠标缩放
            map.enableScrollWheelZoom();
            // 创建一个本地的搜索对象
            var local = new BMapGL.LocalSearch(map, {
                renderOptions:{map: map}
            });
            // 搜索地图的景点
            var inp = document.getElementById("inp");
            inp.onchange = function(e){
                local.search(e.target.value);
            }
        </script>
</body>
</html>